import { configureStore } from '@reduxjs/toolkit';
import counterReducer from './modules/counter';
import recommendedReducer from '@/views/discover/c-components/recommended/store/recommended';
import playerReducer from '@/views/player/store/player';
import rankReducer from '@/views/discover/c-components/ranking/store/rank';
import { songReducer } from '@/views/discover/c-components/songs/store/songs';
import detailReducer from '@/views/detail/store/detail';
import redioReducer from '@/views/discover/c-components/redio/store/redio';

const store = configureStore({
  reducer: {
    couter: counterReducer,
    recommended: recommendedReducer,
    player: playerReducer,
    rank: rankReducer,
    songs: songReducer,
    detail: detailReducer,
    redio: redioReducer,
  },
});
// 从 store 本身推断出 `RootState` 和 `AppDispatch` 类型
export type RootState = ReturnType<typeof store.getState>;
// 推断出类型: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch;

export default store;
